package util.web;

import com.weibo.sdk.android.Weibo;
import android.content.Context;
import android.os.Handler;

public class SinaWeiboHelper {
	public static final int  SUCCESS = 0;
	public static final int LOGIN_FAIL = 1;
	public static final int NO_WEIBO = 2;
	public static final int NETWORK_ERROR = 3;
	public static final int LOGINT_CANCEL = 4;
	public static final int COMMON_ERROR = 5;
	private static final String appKey = "767984283";
	private static final String redirectUrl = "https://api.weibo.com/oauth2/default.html";
	
	/**
	 * 返回最近发的一条weibo
	 * @param context 上下文
	 * @param handler 消息队列
	 * @param usename 要返回的人的用户名
	 * @return weibo
	 */
	public static void getWeibo(Context context, Handler handler, String usename){
		Weibo weibo = Weibo.getInstance(appKey, redirectUrl);
		WeiboDialogListener listener = new WeiboDialogListener(handler, usename);
		weibo.authorize(context, listener);
	}

}
